<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%><%@taglib
	uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Book type detail</title>
	<meta  charset="UTF-8" />
	<link href="css/style.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
		<link href="css/ie6.css" rel="stylesheet" type="text/css" />
	<![endif]-->
	<!--[if IE 7]>
        <link href="css/ie7.css" rel="stylesheet" type="text/css" />  
	<![endif]-->
	
	<style type="text/css">
	table thead th{
		background-color: #49ADE8;
	}
	
	table tr td{
		background-color: #F0F0F0;
	}
	
	.menu-head{
		margin-left:10px;
		font-size:15px; 
		color:white;
	}
	</style>
</head>

<body>
	  <div id="background">
			  <div id="page">
			
					 <div class="header">
						<div class="footer">
							<div class="body">
							  
							  	<!-- include Menu -->
									<jsp:include page="Menu.jsp" flush="True">
										<jsp:param name="page_call"  value="AdminPage"/>
									</jsp:include>
									
									<div id="content" >
									    <img src="images/cotton-flower.jpg" width="726" height="546" alt="" title="">
									    <div class="pagetitlebar">Admin page
											<span class="menu-head">
												<a href="AdminBookList.jsp">ข้อมูลหนังสือ</a> |
												<a href="AdminBookTypeList.jsp">ประเภทหนังสือ</a> |
												<a href="AdminBookList.jsp">จัดการรีวิวหนังสือ</a> |
												<a href="AdminBookList.jsp">จัดการข่าว</a>
											</span>
										</div>
									    
										<div class="pagecontent">
										<b>ข้อมูลประเภทหนังสือ</b>
												<sql:setDataSource dataSource="jdbc/sharewithme" var="sharewithme" />
													<c:catch var="ex">
														<sql:query var="bookTypes" dataSource="${sharewithme}">
															select BTypeID,BTypeName from TBBookType Where BTypeID = ${param.bookTypeId}
														</sql:query>
													</c:catch>
													
													
												
										<form name="formUpdateBookType" method="post" action="BooktypeUpdate.do">
											<table style="border:1px solid; width:100%">
												<tr>
													<th>ID</th>
													<td><input type = "hidden" name="bookTypeId" value="${bookTypes.rows[0].BTypeID}">${bookTypes.rows[0].BTypeID}</td>													
												</tr>
												<tr>
													<th>ประเภทหนังสือ</th>
													<td><input type = "text" name="bookTypeName" value="${bookTypes.rows[0].BTypeName}"></td>
												</tr>
												<tr>
													<th>&nbsp;</th>
													<td>
														<input type = "button" name="btnSave" value="Save" onclick="JavaScript:saveBookType()">
														<input type = "button" name="btnCancel" value="Cancel" onclick="JavaScript:formCancel.submit()">
														<input type = "button" name="btnDelete" value="Delete" style="margin-left:100px;" onclick="JavaScript:deleteBookType()">
													</td>
												</tr>
												
											</table>	
									</form>
									
									<form name="formDelete" method="post" action="BooktypeDelete.do">		
										<input type="hidden" name="bookTypeId" value="${bookTypes.rows[0].BTypeID}"/>								
									</form>
									
									<form name="formCancel" method="post" action="AdminBookTypeList.jsp">										
									</form>

							</div>
									
									</div>
									
									
						</div>
					 </div>
					 <div class="shadow">&nbsp;</div>
			  </div>    
	  </div>    
	</div>
	
	<script type="text/javascript">
	function deleteBookType(){
		if(confirm('Please click ok to confirm delete?')){
			formDelete.submit();
		}
	}
	
	function saveBookType(){
		if(confirm('Please click ok to confirm save book type?')){
			formUpdateBookType.submit();
		}
	}
	</script>
</body>
</html>